<?php


namespace app\service;

use \app\model\articleDiscuss;
use think\response\Json;


class articleDiscussService
{
    // 添加评论
    public static function addDiscuss(array $data): Json
    {
        try {
            $result = articleDiscuss::create($data);
            if (!$result->isEmpty()) {
                return json(['msg' => '评论成功', 'code' => 200], 200);
            }
        } catch (\Exception $e) {
            return \json($e -> getMessage(), $e -> getCode());
        }
    }
}